home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / c / ctags.lha / ctags-3.0.3 / read.h < prev    next >
C/C++ Source or Header  |  1999-02-17  |  4KB  |  95 lines

  1. /*****************************************************************************
  2. *   $Id: read.h,v 7.1 1998/12/07 01:38:00 darren Exp $
  3. *
  4. *   Copyright (c) 1998, Darren Hiebert
  5. *
  6. *   This source code is released for free distribution under the terms of the
  7. *   GNU General Public License.
  8. *
  9. *   External interface to read.c
  10. *****************************************************************************/
  11. #ifndef _READ_H
  12. #define _READ_H
  13.  
  14. #ifdef FILE_WRITE
  15. # define CONST_FILE
  16. #else
  17. # define CONST_FILE const
  18. #endif
  19.  
  20. /*============================================================================
  21. =   Include files
  22. ============================================================================*/
  23. #include "general.h"
  24. #include <stdio.h>
  25. #include "ctags.h"
  26. #include "vstring.h"
  27.  
  28. /*============================================================================
  29. =   Macros
  30. ============================================================================*/
  31. #define fileLanguage()        (File.language)
  32. #define isLanguage(lang)    (boolean)((lang) == File.language)
  33. #define getInputFileLine()    File.lineNumber
  34. #define getFileName()        vStringValue(File.source.name)
  35. #define getFileLine()        File.source.lineNumber
  36. #define getFilePosition()    File.filePosition
  37. #define isHeaderFile()        File.source.isHeader
  38.  
  39. /*============================================================================
  40. =   Data declarations
  41. ============================================================================*/
  42.  
  43. /*  Maintains the state of the current source file.
  44.  */
  45. typedef struct sInputFile {
  46.     vString    *name;        /* name of the input file */
  47.     vString    *path;        /* the path of the input file (if any) */
  48.     FILE    *fp;        /* stream used for reading the file */
  49.     unsigned long lineNumber;    /* line number in the input file */
  50.     fpos_t    filePosition;    /* file position of current line */
  51.     int        ungetch;    /* a single character that was ungotten */
  52.     boolean    newLine;    /* will the next character begin a new line? */
  53.     langType    language;    /* language of input file */
  54.  
  55.     /*  Contains data pertaining to the original source file in which the tag
  56.      *  was defined. This may be different from the input file when #line
  57.      *  directives are processed (i.e. the input file is preprocessor output).
  58.      */
  59.     struct sSource {
  60.     vString    *name;            /* name to report for source file */
  61.     unsigned long lineNumber;    /* line number in the source file */
  62.     boolean     isHeader;        /* is source file a header file? */
  63.     langType language;        /* language of source file */
  64.     } source;
  65. } inputFile;
  66.  
  67. /*============================================================================
  68. =   Global variables
  69. ============================================================================*/
  70. extern CONST_FILE inputFile File;
  71.  
  72. /*============================================================================
  73. =   Function prototypes
  74. ============================================================================*/
  75. #ifdef NEED_PROTO_FGETPOS
  76. extern int fgetpos  __ARGS((FILE *stream, fpos_t *pos));
  77. extern int fsetpos  __ARGS((FILE *stream, fpos_t *pos));
  78. #endif
  79.  
  80. extern const char *getInputFileName __ARGS((void));
  81. extern unsigned long getInputFileLine __ARGS((void));
  82. extern long getInputFilePosition __ARGS((void));
  83. extern char *readLine __ARGS((vString *const vLine, FILE *const fp));
  84. extern void setSourceFileName __ARGS((vString *const fileName));
  85. extern void setSourceFileLine __ARGS((const long unsigned int lineNumber));
  86. extern boolean fileOpen __ARGS((const char *const fileName, const langType language));
  87. extern void fileClose __ARGS((void));
  88. extern int fileGetc __ARGS((void));
  89. extern void fileUngetc __ARGS((int c));
  90. extern char *readSourceLine __ARGS((vString *const vLine, const fpos_t *const pLocation, long *const pSeekValue));
  91.  
  92. #endif    /* _READ_H */
  93.  
  94. /* vi:set tabstop=8 shiftwidth=4: */
  95.